/*
 * Copyright 2020-2025 the original author or authors.
 * You cannot use this file unless authorized by the author.
 */
package org.ipig.commons.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 防止重复提交注解，用于方法上<br/>
 * 在新建页面方法上，设置saveToken()为true，此时拦截器会在Session中保存一个repeatSubmitToken， <br/>
 * 同时需要在新建的页面中添加
 * <input type="hidden" name="repeatSubmitToken" value="${repeatSubmitToken}">
 * <br/>
 * 保存方法需要验证重复提交的，设置removeToken为true 此时会在拦截器中验证是否重复提交
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $$Id: RepeatSubmitToken.java 3 2020-01-21 09:36:33Z ts <comchnts@163.com> $$
 * @since 1.0
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RepeatSubmitToken {

    /**
     * 重复提交token KEY
     */
    public static final String REPEAT_SUBMIT_TOKEN_KEY = "repeatSubmitToken";

    /**
     * 保存token
     *
     * @return boolean
     */
    boolean saveToken() default false;

    /**
     * 移除token
     *
     * @return boolean
     */
    boolean removeToken() default false;
}
